//index.js
//获取应用实例
const app = getApp()
const qiniuUploader = require("../../utils/qiniuUploader");
Page({
  data: {
    type: 0,
    userType: 0,
    userId: 0,
    familyId:0
  },

  onLoad: function(options) {
    this.setData({
      type: options.result,
      userType: options.userType,
      userId: options.userId,
      familyId: options.familyId,
    })
  },


  btnAgain() {
    this.chooseWxImageNew(this.data.userType, this.data.userId,this.data.familyId);
  },

  btnReturn() {
    wx.navigateBack()
  },


  chooseWxImage(userType, userId, familyId) {
    wx.chooseImage({
      count: 1,
      sizeType: ['compressed'],
      sourceType: ['camera'],
      success: function(res) {
        console.log(res.tempFilePaths)
        console.log(res.tempFiles[0].size);
        wx.redirectTo({
          url: '../preview/preview?src=' + res.tempFilePaths[0] + '&userType=' + userType + '&userId=' + userId + "&familyId=" + familyId,
        })
      },
    })
  },

  chooseWxImageNew(userId, userType, familyId) {
    wx.redirectTo({
      url: '../newcamera/newcamera?userType=' + userType + '&userId=' + userId + '&familyId=' + familyId,
    })
  },
})